import axios from 'axios'
import {gettoken} from '../utils/auth'
const ajax = axios.create({
  baseURL: '/myApi'
})



ajax.interceptors.request.use(config=>{
  //读取token
  let token = gettoken()
  if(token){
    config.headers = { Authorization: `Bearer ${token}` }
  }
  return config
})

ajax.interceptors.response.use(result =>{
  return result.data
},err=>{
  
})


export default ajax